package com.augurit.gzcgwsp.csshlj.convert;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import org.dozer.DozerBeanMapper;

import com.augurit.gzcgwsp.csshlj.entity.ShljYsBa;
import com.augurit.gzcgwsp.csshlj.entity.ShljqsBa;
import com.augurit.gzcgwsp.csshlj.form.ShljYsBaForm;
import com.augurit.gzcgwsp.csshlj.form.ShljYsForm;
import com.augurit.gzcgwsp.csshlj.form.ShljqsBaForm;
import com.augurit.gzcgwsp.smartformCsdlwj.web.form.ShljqsForm;

/**
 * 水域生活垃圾备案
 * @author Administrator
 *
 */

public class YwSyShljysBaConvertor {
    public static ShljYsBaForm convertVoToForm(ShljYsBa entity) {
        if (entity == null) return null;
        ShljYsBaForm form = new DozerBeanMapper().map(entity, ShljYsBaForm.class);        
        return form;
    }
    
    public static ShljYsBaForm convertVoToForm(ShljYsBa entity ,ShljYsForm qsForm) {
        if (entity == null) return null;
        ShljYsBaForm form = new DozerBeanMapper().map(qsForm, ShljYsBaForm.class);
        form.setId(entity.getId());
        form.setAcceptNo(entity.getAcceptNo());
        form.setAcceptNo2(entity.getAcceptNo());
        form.setSyysid(entity.getSyysid());
        form.setSqrq(entity.getSarq());
        return form;
    }
    

    
    public static void convertFormToVo(ShljYsBaForm form, ShljYsBa entity) {
        if (form == null) return;
        if (entity == null) entity = new ShljYsBa();
        
        new DozerBeanMapper().map(form, entity);
    }
    
    public static void convertYsFormToYsBaForm(ShljYsBaForm formba,ShljYsForm form) {
        if (form == null) return;
        Date slrq=formba.getSlrq();
        Date sarq=formba.getSarq();
        String acceptNo=formba.getAcceptNo();
        String sjr=formba.getSjr();
        new DozerBeanMapper().map(form,formba);
        formba.setAcceptNo(acceptNo);
        formba.setSarq(sarq);
        formba.setSlrq(slrq);
        formba.setSjr(sjr);
    }
    
    public static List<ShljYsBaForm> convertVoListToFormList(List<ShljYsBa> shljYsBaList) {
        if(shljYsBaList != null && shljYsBaList.size() > 0) {
            List<ShljYsBaForm> baFormList = new ArrayList();
            for(int i=0; i<shljYsBaList.size(); i++) {
            	baFormList.add(convertVoToForm(shljYsBaList.get(i)));
            }
            return baFormList;
        }
        return null;
    }
    
    public static List<ShljYsBa> convertFormListToVoList(List<ShljYsBaForm> shljYsBaFormList) {
        if(shljYsBaFormList != null && shljYsBaFormList.size() > 0) {
            List<ShljYsBa> shljYsBaList = new ArrayList();
            for(int i=0; i<shljYsBaFormList.size(); i++) {
                ShljYsBa ShljYsba = new ShljYsBa();
                convertFormToVo(shljYsBaFormList.get(i),ShljYsba);
                shljYsBaList.add(ShljYsba);
            }
            return shljYsBaList;
        }
        return null;
    }
}